function [ kbest ] = findkbest( cost_mat, k )
%K-BEST Find the k-best assignments in java.

% Example usage:
% costMat = rand(20, 20);
% k = 5;
% kbest = findkbest(costMat, k);
% kbest

eval(['javaaddpath ' pwd() '/java-k-best.jar']);

lst = com.google.code.javakbest.Murty.solve(cost_mat, k);

kbest = {};

for i=0:lst.size()-1
    kbest{i+1} = lst.get(i)';
end

end
